package com.nuonuo.middleware.filter;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author duan
 * @version 1.0
 * @date 2023/9/14 18:51
 */
public class ConsoleFilter extends Filter<ILoggingEvent> {

    @Override
    public FilterReply decide(ILoggingEvent event) {
        boolean consoleEnabled = Boolean.valueOf(System.getProperty("console.enabled", "true"));
        if (consoleEnabled) {
            return FilterReply.ACCEPT;
        }

        return FilterReply.DENY;
    }
}
